#ifndef __PID_H_
#define __PID_H_

typedef struct
{
  float kp;
	float ki;
	float kd;
	
	float target_value;//目标值
	float feedback_value;//返回值
	float err[2];//误差值
	
	float p_out;
	float i_out;
	float d_out;
	float out;

}pid_t;

typedef struct
{
    pid_t inner; //内环
    pid_t outer; //外环
    float output; //串级输出，等于inner.output
}CascadePID;


void pid_init(pid_t *pid);
void pid_speed(pid_t *pid,float target,float current);


#endif
